package ADT;
import java.util.LinkedList;

public class myQueue {

	LinkedList<Process> list;

	public myQueue() {
		list = new LinkedList<Process>();
	}

	public void enqueue(Process process) {
		if (process != null)
			list.addFirst(process);
	}

	public Process dequeue() {
		if (list.isEmpty())
			return null;
		return list.removeLast();
	}

	public Process peek() {
		if (list.isEmpty())
			return null;
		return list.getLast();
	}

	public int size() {
		return list.size();
	}

	public boolean isEmpty() {
		return list.size() == 0;
	}

	public Process get(int index) {
		return (list != null && list.size() > index) ? list.get(index) : null;
	}

	public Process remove(int index) {
		return list.remove(index);
	}
}
